package tdd.refactor;

public class TaxiFeeFactory {
	static final int DAYNIGHT_TIME = 6;
	static final int NIGHT_TIME = 23;
	TaxiFeeFactory() {}
	
	TaxiFeeCity getTaxiFeeNanjing(TaxiFeeModel model) {
		TaxiFeeCity fee = new TaxiFeeCity();
		fee.add(new BaseFee(model));
		return fee;
	}
	
	TaxiFeeCity getTaxiFeeSH(TaxiFeeModel model, TaxiFeeModelExtra modelEx) {
		TaxiFeeCity fee = new TaxiFeeCity();
		fee.add(new BaseFee(model));
		fee.add(new ExtraFee(modelEx));
		return fee;
	}
	
	TaxiFeeCity getTaxiFeeSHOuter(TaxiFeeModel model, TaxiFeeModel modelOuter) {
		TaxiFeeCity fee = new TaxiFeeCity();
		fee.add(new BaseFee(model));
		fee.add(new BaseFeeOuter(modelOuter, model.startMiles));
		return fee;
	}

	public TaxiFeeCity getTaxiFeeSHOuter(TaxiFeeModel model) {
		TaxiFeeCity fee = new TaxiFeeCity();
		fee.add(new BaseFee(model));
		return fee;
	}
		
	public static TaxiFeeTime getTaxiFeeNanjing() {
		TimeFee timeFeeNJ = new TimeFee(11.0, 1.6, 13.0, 2.4);
		JudgeTime judgeTime = new JudgeTime();
		TaxiFeeModel modelD = new TaxiFeeModel(6, 23, 3);
		modelD.init(DAYNIGHT_TIME, timeFeeNJ, judgeTime);
		TaxiFeeModel modelN = new TaxiFeeModel(6, 23, 3);
		modelN.init(NIGHT_TIME, timeFeeNJ, judgeTime);
		
		TaxiFeeCity feeDaylight = new TaxiFeeCity();
		feeDaylight.add(new BaseFee(modelD));
		TaxiFeeCity feeNight = new TaxiFeeCity();
		feeNight.add(new BaseFee(modelN));		
		
		return new TaxiFeeTime(new TaxiFeeCityAdapter(feeDaylight),new TaxiFeeCityAdapter(feeNight));
	}	
	public static TaxiFeeTime getTaxiFeeSH() {
		TimeFee timeFeeSH = new TimeFee(14.0, 2.5, 3.5, 18.0, 3.0, 4.7);
		JudgeTime judgeTime = new JudgeTime();
		TaxiFeeModel modelD = new TaxiFeeModel(6, 23, 3);
		modelD.init(DAYNIGHT_TIME, timeFeeSH, judgeTime);
		TaxiFeeModelExtra modelExD = new TaxiFeeModelExtra(modelD, 10);
		modelExD.init(DAYNIGHT_TIME, timeFeeSH, modelD, judgeTime);
		TaxiFeeModel modelN = new TaxiFeeModel(6, 23, 3);
		modelN.init(NIGHT_TIME, timeFeeSH, judgeTime);
		TaxiFeeModelExtra modelExN = new TaxiFeeModelExtra(modelN, 10);
		modelExN.init(NIGHT_TIME, timeFeeSH, modelN, judgeTime);
		
		TaxiFeeCity feeDaylight = new TaxiFeeCity();
		feeDaylight.add(new BaseFee(modelD));
		feeDaylight.add(new ExtraFee(modelExD));
		TaxiFeeCity feeNight = new TaxiFeeCity();
		feeNight.add(new BaseFee(modelN));		
		feeNight.add(new ExtraFee(modelExN));
		
		return new TaxiFeeTime(new TaxiFeeCityAdapter(feeDaylight),new TaxiFeeCityAdapter(feeNight));
	}	
	
	public static TaxiFeeTime getTaxiFeeSHOuter() {
		TimeFee timeFeeSH = new TimeFee(14.0, 2.5, 3.5, 18.0, 3.0, 4.7);
		JudgeTime judgeTime = new JudgeTime();
		TaxiFeeModel modelD = new TaxiFeeModel(6, 23, 3);
		modelD.init(DAYNIGHT_TIME, timeFeeSH, judgeTime);
		TaxiFeeModel modelN = new TaxiFeeModel(6, 23, 3);
		modelN.init(NIGHT_TIME, timeFeeSH, judgeTime);
		
		TaxiFeeCity feeDaylight = new TaxiFeeCity();
		feeDaylight.add(new BaseFee(modelD));
		TaxiFeeCity feeNight = new TaxiFeeCity();
		feeNight.add(new BaseFee(modelN));		
		
		return new TaxiFeeTime(new TaxiFeeCityAdapter(feeDaylight),new TaxiFeeCityAdapter(feeNight));
	}	
}
